package com.mega.fe.util;

import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class NonNullIterable<T> implements Iterable<T> {
    private Iterable<T> iterable;

    public NonNullIterable(Iterable<T> iterable) {
        this.iterable = iterable;

    }

    @Override
    public Iterator<T> iterator() {
        return StreamSupport.stream(iterable.spliterator(), false)
                .filter(element -> element != null)
                .iterator();
    }
}